package com.example.factory;

import com.example.factory.config.BusinessEnum;
import com.example.factory.responsibility.Context;
import com.example.factory.responsibility.ResourceWrapper;
import com.example.factory.responsibility.chain.builder.DefaultProcessChainBuilder;
import com.example.factory.responsibility.chain.ProcessChain;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class FactoryApplication {

	public static void main(String[] args) {
		ConfigurableApplicationContext context = SpringApplication.run(FactoryApplication.class, args);
		/*System.out.println(" show the word ");
		ControlCenter controlCenter = context.getBean("controlCenter", ControlCenter.class);
		String name = controlCenter.getStrategy(StrategyType.Ferrari).getName();
		System.out.println("getName :" + name);
*/
		DefaultProcessChainBuilder chainBuilder = context.getBean("defaultProcessChainBuilder", DefaultProcessChainBuilder.class);
		ProcessChain builder = chainBuilder.builder();
//
//		Param<ProcessNode> defaultFirstProcessNodeParam = new Param<>();
//		DefaultFirstProcessNode defaultFirstProcessNode = new DefaultFirstProcessNode();
//		defaultFirstProcessNodeParam.setParm(defaultFirstProcessNode);
		Context baoma = new Context();
		baoma.setBusiness(BusinessEnum.BAOMA_SERVICE);
		builder.entry(baoma,new ResourceWrapper(),null);
	}

}
